package com.uu;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;

import java.util.Properties;

/**
 * <p>Description:  </p>
 *
 * @author chenyang
 * @version x.x.x
 * @date 2020.07.13 12:34
 * @since x.x.x
 */
public class ClientMain {

    public static void main(String[] args) {
        try {
            // Initialize the configuration service, and the console automatically obtains the following parameters through the sample code.
            String serverAddr = "127.0.0.1:8848";
            String dataId = "demo.properties";
            String group = "DEFAULT_GROUP";
            Properties properties = new Properties();
            properties.put("serverAddr", serverAddr);
            ConfigService configService = NacosFactory.createConfigService(properties);
            // Actively get the configuration.
            String content = configService.getConfig(dataId, group, 5000);
            System.out.println(content);
        } catch (NacosException e) {
            e.printStackTrace();
        }
    }
}
